// 240.搜索二维矩阵2
package LeetcodeHot100;

public class Solution240 {
    public boolean searchMatrix(int[][] matrix, int target) {
        int start_x = 0;
        int start_y = matrix[0].length - 1;
        while (start_x < matrix.length && start_y >= 0) {
            if (matrix[start_x][start_y] == target)
                return true;
            else if (matrix[start_x][start_y] < target)
                start_x++;
            else
                start_y--;
        }
        return false;
    }
}
